<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>DB LINQ and SQL Bulk Insert</title>
    <link rel="stylesheet" type="text/css" href="../lib/style2.css"/>
    <style type="text/css">
        .style2
        {
            color: #009900;
        }
    </style>
</head>
<body>
<a href="../Default.aspx">&gt;Code2Code.net Home</a>  &nbsp; 
<a href="index.html">&gt;DB Linq Project Home</a>  &nbsp; 
<br />
<h2>
    Stored proc support in the official Microsoft Linq-to-SQL</h2>
    In the Microsoft implementation (official Linq-to-SQL), stored procs are fully supported.
    By default, they won't appear in your mapping file database .cs file - you need
    to use the '-sprocs' flag to turn on support. Microsoft appears to use parsing of
    T/SQL&nbsp; to determine the shape of resultset. On very complex procs, I have seen
    the parser crash (using Orcas Beta1).<h2>
        Stored Procs in DB LINQ provider for MySql/PostgreSql</h2>
    MySql differentiates between functions and procedures. Functions return a scalar
    of pre-defined type and cannot have OUT-parameters. Stored Procs, on the other had,
    can return a resultset and have multiple in/out parameters.<br />
    In DB Linq, we have full support for functions. However, there is no parsing functionality,
    and thus stored proc return a DataSet. (Actually, there is a simplistic parsing
    step, looking for the word 'select' in the body of the stored proc. If there is
    no select, we assume that it won't return a resultset)<br />
    <br />
    Notes:<br />
    Turn on stored proc support via -sprocs<br />
    Stored Functions return typed results<br />
    Stored Procedures return DataSet or void<br />
    <br />
    TODO:<br />
    Add a SqlMetal GUI screen where user could invoke the stored proc to determine shape
    of resultset.

</body>
</html>
